<template>
  <div>
    <a-modal :width="500" title="设置手势密码" v-model="visible" @ok="handleOk">
      <div class="wfull flx-c">
        <ZgGesture :isCheck="false" @change="onChange"></ZgGesture>
      </div>
    </a-modal>
  </div>
</template>

<script>
export default {
  data () {
    return {
      visible: false,
      gesture: ''
    }
  },
  mounted () {
  },
  methods: {
    onChange (gesture) {
      this.gesture = gesture
    },
    open () {
      this.visible = true
    },
    close () {
      this.visible = false
    },
    handleOk () {
      if (this.gesture.length === 0) {
        this.$warning({ title: '请设置手势密码' })
        return
      }
      this.$http.post('/zg-system/user/gesture/change', this.gesture, () => {
        this.close()
        this.$info({ title: '操作成功！' })
        this.$emit('ok', this.gesture)
      })
    }
  }
}
</script>
<style lang="less" scoped>
</style>
